//
//  LoginViewController.m
//  DouBan
//
//  Created by dllo on 16/6/25.
//  Copyright © 2016年 zuzhiming. All rights reserved.
//

#import "LoginViewController.h"
#import "RegisterViewController.h"
@interface LoginViewController ()
@property (retain, nonatomic) IBOutlet UIButton *registerButton;

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    [self createGoBackButton];
}

- (void)createGoBackButton
{
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(goBackAction:)];
    
    [self.registerButton addTarget:self action:@selector(forwardToRegisterPage:) forControlEvents:UIControlEventTouchUpInside];
}
//跳转注册页面
- (void)forwardToRegisterPage:(UIButton *)button
{
    RegisterViewController *rvc = [[RegisterViewController alloc] init];
    [self.navigationController pushViewController:rvc animated:YES];
}

//返回上一级页面
- (void)goBackAction:(UIBarButtonItem *)leftBarButton
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationItem.title = @"用户登录";
    self.navigationItem.hidesBackButton = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)dealloc {
    [_registerButton release];
    [super dealloc];
}
@end
